package com.example.computer_exam_training_sys.controller;

import com.example.computer_exam_training_sys.service.WrongQuestionDetailService;
import com.example.computer_exam_training_sys.vo.WrongQuestionWithDetail;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/wrongquestions")
@CrossOrigin
public class WrongQuestionDetailController {

    @Autowired
    private WrongQuestionDetailService wrongQuestionDetailService;

    //错题详情表和题目表根据题目id联合查询单个用户的错题
    //http://localhost:8080/wrongquestions/details/byuser?userId=2
    @GetMapping("/details/byuser")
    public List<WrongQuestionWithDetail> getWrongQuestionsWithDetail(@RequestParam Integer userId) {
        return wrongQuestionDetailService.ByUserId(userId);
    }

}
